package com.yy.base.util;

import javax.servlet.http.HttpServletRequest;
import com.mes.entity.User;

public class UserUtil {
	public static final String USERSESSION = "USERSESSION";
	/**
	 * 获取当前登录用户
	 */
	public static User getLoginUser(HttpServletRequest request) {
		User user = getUser();
		if (user == null) {
			user = (User)request.getSession().getAttribute(USERSESSION);
			SessionInfo.setUser(user);
		}
		return user;
	}
	
	public static User getUser() {
		return SessionInfo.getUser();
	}
}